package com.yingli.fragment.bottomnavigation;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.yingli.fragment.R;

public class BottomNavigationActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bottomnavigation);
        BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_menu);
        //设置每一项的显示的图标的样式列表
        bottomNavigationView.setItemIconTintList(null);
        bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
            int itemId = item.getItemId();
            switch (itemId){
                case R.id.wechat:
                    //做滑动处理
                    Toast.makeText(BottomNavigationActivity.this,"微信",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.contact:
                    Toast.makeText(BottomNavigationActivity.this,"通讯录",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.find:
                    Toast.makeText(BottomNavigationActivity.this,"发现",Toast.LENGTH_SHORT).show();
                    break;
                default:
                    Toast.makeText(BottomNavigationActivity.this,"我",Toast.LENGTH_SHORT).show();
                    break;
            }
            return true;
        });
//        bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
    }
}
